package java2015;

import java.util.Scanner;

public class Java11 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        String s1;
        int n;
        n = sc.nextInt();
        s1 = sc.nextLine();
        while(sc.hasNextLine()){
        	String choice;
        	choice = sc.nextLine();
        	switch(choice){
        	case "sort1" :
        		String result = getBirthDate(s1);
        		break;
        		
        	}
        }
	}

	private static String getBirthDate(String s1) {
		String str1 = s1.substring(6,9);
		String str2 = s1.substring(10,11);
		String str3 = s1.substring(12,13 );
		String result =str1 + "-" + str2 + "-" +str3;
		System.out.println(result);
		return null;
	}

}
